<?php

class ChangePwdAction extends CAction{

	public $modelName = 'UpdatePwdForm';
	public $view;
	
	public function run() {
		$c = $this->controller;
		$modelName = $this->modelName;
		$model = new $modelName();
		$model->memberModel = 'MemberAccount';
		$model->memberId = Yii::app()->adminUser->id;
		if (isset($_POST[$modelName])) {
			$model->attributes = $_POST[$modelName];
			if ($model->validate() && $model->save()) {
				Yii::app()->user->setFlash('updatePwd', '修改成功');
				$c->refresh();
			}
		}
		
		$c->render($this->view,array('model'=>$model));
	}
}

?>